package com.zheng.damo01.作业;

import java.util.Scanner;

public class Test08 {
    public static void main(String[] args) {
        Uesr u1=new Uesr("a",123);
        Uesr u2=new Uesr("b",1234);
        Uesr u3=new Uesr("c",12368);
        Uesr u4=new Uesr("d",1000);
        Uesr[] uesrs={u1,u2,u3,u4};
        System.out.println("请输入用户名");
        String str1=new Scanner(System.in).nextLine();
        System.out.println("请输入密码");
        String str2=new Scanner(System.in).nextLine();
        for (int i = 0; i < uesrs.length; i++) {
            if (uesrs[i].getName().equals(str1)){
                if (uesrs[i].getNumber().equals(Integer.parseInt(str2))){
                    System.out.println("登录成功");
                    return;
                }else {
                    System.out.println("密码错误");
                    return;
                }
            }
        }
        System.out.println("没有该用户");



    }
}
class Uesr{
    private String name;
    private Integer number;

    public Uesr() {
    }

    public Uesr(String name, Integer number) {
        this.name = name;
        this.number = number;
    }

    @Override
    public String toString() {
        return "Uesr{" +
                "name='" + name + '\'' +
                ", number=" + number +
                '}';
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getNumber() {
        return number;
    }

    public void setNumber(Integer number) {
        this.number = number;
    }
}
